package BookOperation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class AddBook implements IOperation{
    @Override
    public void work(BookList bookList) {

        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入书名:>");
        String name = scanner.nextLine();
        System.out.print("请输入作者:>");
        String author = scanner.nextLine();
        System.out.print("请输入价格:>");
        int price = scanner.nextInt();
        scanner.nextLine();
        System.out.print("请输入类型:>");
        String type = scanner.nextLine();
        System.out.println("存入成功");
        Book books = new Book(name,author,price,type);
        int size = bookList.getUseSize();
        bookList.setBooks(books);
        bookList.setUseSize(size+1);
    }
}

